package cn.zyjw.feign;

import feign.Response;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class Oauth2ServerFallBackFactory implements FallbackFactory<OAuth2FeignClient> {
    @Override
    public OAuth2FeignClient create(Throwable throwable) {

        return new OAuth2FeignClient() {
            @Override
            public Response getJwtToken(String grantType, String username, String password, String loginType, String clientToken) {
                log.info("OAuth2FeignClient getJwtToken 请求异常 => {}",throwable.getMessage());
                return null;
            }
        };
    }
}
